home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Tools 5
/
Amiga Tools 5.iso
/
tools
/
developer-tools
/
aros
/
libs
/
makeflags
< prev
next >
Wrap
Text File
|
1996-07-15
|
5KB
|
190 lines
# $Id: MakeFlags 1.1 1995/11/05 22:25:15 digulla Exp digulla $
# $Log: MakeFlags $
# Revision 1.1 1995/11/05 22:25:15 digulla
# Initial revision
#
# Options section. Specify the comiler/environment you want to use
# Choose one and comment the others out
CC = sc
#CC = gcc
#CC = dcc
ifeq "$(CC)" "sc"
COMMON_CFLAGS = NoVersion NoStkChk
OPT_CFLAGS = Optimize
DEBUG_CFLAGS = Debug Full Define DEBUG
PROFILE_CFLAGS = Define PROFILE
EXTRA_CFLAGS =
INCLUDE_DIR = IDir
INCLUDES = # User
LIB_PREFIX =
LIB_SUFFIX = .lib
SYS_INCLUDES =
STD_INCLUDES = $(INCLUDES) $(SYS_INCLUDES)
DEFINES =
SYS_DEFINES =
STD_DEFINES = $(DEFINES) $(SYS_DEFINES)
AR = join as
PARENT_DIR = /
AS = Asm
endif
ifeq "$(CC)" "gcc"
COMMON_CFLAGS = -msmall-code -Wall -Wpointer-arith
OPT_CFLAGS = -O2
DEBUG_CFLAGS = -gstabs # For the Barfly debugger
PROFILE_CFLAGS = -p # If someone ever writes a profiler
EXTRA_CFLAGS =
INCLUDE_DIR = -I
INCLUDES = # User
LIB_PREFIX = lib
LIB_SUFFIX = .a
SYS_INCLUDES =
STD_INCLUDES = $(INCLUDES) $(SYS_INCLUDES)
AR = ar u
PARENT_DIR = ../
AS = A68k
endif
ifeq "$(CC)" "dcc"
endif
# How to run certain commands
RM = delete quiet all
MV = rename
CP = copy quiet all
MKDIR = MakeDir
ECHO = echo
INSTALL_PROGRAM = copy
INSTALL_DATA = copy
LHA_FULL = lha -x -a -r -e a
LHA_DELTA = lha -x -a -r -e -s a
# Things for make
# BUILD_OPTS : how to build target files. This is a set of flags:
# o - Use optimization when building target files (when
# applicable)
# g - Include debugging information
# p - Include profiling information
# Multiple flags can be specified in any order, ie. "gop" will
# enable all options. Note that for some compilers, o and g
# exclude each other.
# EXTRA_MAKEFLAGS - The contents of this variable is passed to sub-makes
# PASSMAKEFLAGS - (internal) This variable contains everything that should
# always be passed to sub-makes (additional to MAKEFLAGS)
BUILD_OPTS = g
EXTRA_MAKEFLAGS =
PASSMAKEFLAGS = "TOP_DIR=$(TOP_DIR)" "EXTRA_MAKEFLAGS=$(EXTRA_MAKEFLAGS)" \
"BUILD_OPTS=$(BUILD_OPTS)"
prefix = $(TOP_DIR)
exec_prefix = $(prefix)
bindir = $(exec_prefix)c/
libdir = $(exec_prefix)lib/
includedir = $(exec_prefix)include/
docdir = $(exec_prefix)doc/
exampledir = $(exec_prefix)examples/
# This is used as a pattern for making something in subdirs. Use it with
# $(subst TARGET,all,$(SUBDIR_RULE))
SUBDIR_RULE = unset dir @@\
for dir in $(SUBDIRS) \
do \
$(ECHO) "Making TARGET in $(CURRENT_DIR)$$dir" ";" \
( cd $$dir ";" $(MAKE) $(PASSMAKEFLAGS) \
"CURRENT_DIR=$(CURRENT_DIR)$$dir/" TARGET ) \
done
# Set flags for optimizations
ifneq (,$(findstring o,$(BUILD_OPTS)x))
CFLAGS_1 = $(OPT_CFLAGS)
SUFFIX_1 = o
else
CFLAGS_1 =
SUFFIX_1 =
endif
# Set flags for debugging
ifneq (,$(findstring g,$(BUILD_OPTS)x))
CFLAGS_2 = $(DEBUG_CFLAGS)
SUFFIX_2 = g
else
CFLAGS_2 =
SUFFIX_2 =
endif
# Set flags for profiling
ifneq (,$(findstring p,$(BUILD_OPTS)x))
CFLAGS_3 = $(PROFILE_CFLAGS)
SUFFIX_3 = p
else
CFLAGS_3 =
SUFFIX_3 =
endif
OPT_SUFFIX = $(SUFFIX_1)$(SUFFIX_2)$(SUFFIX_3)
ifneq "$(OPT_SUFFIX)" ""
OBJDIR = obj_$(OPT_SUFFIX)
else
OBJDIR = obj
endif
CFLAGS = $(strip $(COMMON_CFLAGS) $(EXTRA_CFLAGS) \
$(CFLAGS_1) $(CFLAGS_2) $(CFLAGS_3) \
$(DEFINES) $(INCLUDES))
# Use this at a leaf-rule as the last line so the use can see we're through
define done-with-it
@$(ECHO) "Done with $@ in $(CURRENT_DIR)"
endef
# Use this in a Makefile where a specific rule doesn't apply
define nothing-to-be-done
@$(ECHO) "Nothing to be done for $@ in $(CURRENT_DIR)"
endef
.PHONY : all clean dist check install
ifeq "$(CC)" "sc"
CC_COMPILE = $(CC) $(CFLAGS)
CC_LINK = $(CC) $(CFLAGS) Link To
define run-cc
$(CC) $(CFLAGS) $<
-$(RM) $@
$(MV) $(dir $<)$(notdir $@) $@
endef
endif
ifeq "$(CC)" "gcc"
CC_COMPILE = $(CC) $(CFLAGS) -c
CC_LINK = $(CC) $(CFLAGS) -o
define run-cc
-$(RM) $@
$(CC_COMPILE) $< -o $@
endef
endif
ifeq "$(CC)" "dcc"
CC_COMPILE = $(CC) $(CFLAGS) -c
CC_LINK = $(CC) $(CFLAGS) -o
define run-cc
-$(RM) $@
$(CC_COMPILE) $< -o $@
endef
endif
define do-dist
@$(ECHO) "" > dist.dev
$(foreach file,$(DEV_DIST_FILES),$(ECHO) "AROS/$(CURRENT_DIR)$(file)" >> dist.dev @@)
$(foreach dir,$(SUBDIRS),$(ECHO) "@AROS/$(CURRENT_DIR)$(dir)/dist.dev" >> dist.dev @@)
$(ECHO) "" > dist.usr
$(foreach file,$(USR_DIST_FILES),$(ECHO) "AROS/$(CURRENT_DIR)$(file)" >> dist.usr @@)
$(foreach dir,$(SUBDIRS),$(ECHO) "@AROS/$(CURRENT_DIR)$(dir)/dist.usr" >> dist.usr @@)
endef
MAKEDEPEND = MkDepend
define make-depend
@if not exists $(OBJDIR) @@\
makedir $(OBJDIR) @@\
endif
$(MAKEDEPEND) -f $@ -p ".c:$(OBJDIR)/%n.o $(OBJDIR)/%n.d" $< \
$(patsubst $(INCLUDE_DIR),-I,$(INCLUDES)) -I $(SRCDIR)
endef